module("ufe.policies.value_header", package.seeall)
local m = require("ufe.ufe_module")

local name = "header"

local function check(vcf)
    if type(vcf.name) ~= 'string' then
        return nil, "name in header value must be a string"
    end
    vcf.name = string.gsub(vcf.name,'%-','_')
    return true
end

local function value(vcf)
    return ngx.var["http_"..vcf.name]
end

m.register_value(name, {check = check, value = value })
